FROM xiaobu191/php-7.4.33-cli-bullseye

SHELL ["/bin/bash", "-cex"]

# 安装客户端驱动 taos
RUN wget https://www.taosdata.com/assets-download/3.0/TDengine-client-3.3.0.0-Linux-x64.tar.gz \
    && tar -xzvf TDengine-client-3.3.0.0-Linux-x64.tar.gz \
    && cd TDengine-client-3.3.0.0 && ./install_client.sh \
    && cd .. && rm -rf TDengine-client-3.3.0.0 TDengine-client-3.3.0.0-Linux-x64.tar.gz

# 安装 PHP 连接器扩展 php-tdengine
RUN curl -L -o php-tdengine.tar.gz https://github.com/Yurunsoft/php-tdengine/archive/refs/tags/v1.0.6.tar.gz \
        && mkdir php-tdengine \
        && tar -xzf php-tdengine.tar.gz -C php-tdengine --strip-components=1 \
        && cd php-tdengine && phpize && ./configure && make -j && make install \
        && echo 'extension=tdengine' >> /usr/local/etc/php/conf.d/docker-php-ext-tdengine.ini \
        && cd .. && rm -rf php-tdengine php-tdengine.tar.gz
